//
//  LJMAdaption_Height_Width.m
//  wind
//
//  Created by 李金明 on 16/1/11.
//  Copyright © 2016年 李金明. All rights reserved.
//

#import "LJMAdaption_Height_Width.h"

@implementation LJMAdaption_Height_Width
#pragma 自适应高度
+ (CGFloat)heightWithStr:(NSString *)str width:(CGFloat)width NSInter:(CGFloat)cgf
{
    CGRect frame = [str boundingRectWithSize:CGSizeMake(width, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:cgf] forKey:NSFontAttributeName] context:nil];
    
    return frame.size.height;
    
}

#pragma 自适应宽度
+ (CGFloat)widthWithStr:(NSString *)str NSInter:(CGFloat)cgf
{
    
    CGRect frame = [str boundingRectWithSize:CGSizeMake(1000, 30) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:cgf] forKey:NSFontAttributeName] context:nil];
    
    return frame.size.width;
}

@end
